Ultrahigh-fidelity spatial mode quantum gates in high-dimensional space by diffractive deep neural networks

While the spatial mode of photons is widely used in quantum cryptography, its potential for quantum computation remains largely unexplored. Here, we showcase the use of the multi-dimensional spatial mode of photons to construct a series of high-dimensional quantum gates, achieved through the use of diffractive deep neural networks (D2NNs). Notably, our gates demonstrate high fidelity of up to 99.6(2)%, as characterized by quantum process tomography. Our experimental implementation of these gates involves a programmable array of phase layers in a compact and scalable device, capable of performing complex operations or even quantum circuits. We also demonstrate the efficacy of the D2NN gates by successfully implementing the Deutsch algorithm and propose an intelligent deployment protocol that involves self-configuration and self-optimization. Moreover, we conduct a comparative analysis of the D2NN gate’s performance to the wave-front matching approach. Overall, our work opens a door for designing specific quantum gates using deep learning, with the potential for reliable execution of quantum computation.


Supplementary Note 2: Matrix representation of quantum gates, MUBs and complement results
In the three-dimensional space, the Pauli X gate is no longer limited to flipping two computational bases, but rather cyclic shift-transformation of three bases as the matrix representation described in Eq. (S1).Operation X0 is the identity matrix and shifts no input.X1 and X2 shift the input basis states once and twice, respectively.0 1 2 1 0 0 0 1 0 0 0 1 0 1 0 , 0 0 1 , 1 0 0 0 0 1 1 0 0 0 1 0 The matrix representation of three-dimensional Hadamard gates is described by eq.(S2), where The CNOT gate operating on 2×2-dimensional space has more complicated MUBs.We construct an overcomplete state set from the column vectors in matrix S which is the tensor product of six two-dimensional MUBs, as shown in eq.(S3).This state set with 36 state vectors oversteps the range of four-dimensional MUBs but still works in quantum process tomography.
As a complement to the results presented in the main text, we characterize the rest of the three-dimensional gates, including the X2, H2, and H3 gates.Fig. S3a-c presents the tomography matrices of these three gates, and Fig. S3d-f are the corresponding reconstructed process matrices χ .The fidelities are around 97% revealing decent performance.

Supplementary Note 3: Quantum process tomography reconstruction with maximum-likelihoodestimation method
The maximum-likelihood-estimation principle as a mature method has been applied in quantum state tomography and quantum process tomography for a long time.Here we briefly introduce the procedure of it.
Considering an unknown quantum process E is a linear completely positive map E M from the Hilbert space H to the Hilbert space K , we can test it with a bunch of probe states m ρ , and the output states ( ) ( ) , where Tr H is the partial trace of space H , and K I is the identity operator on space K , and T denotes the transposition.The trace-preserve (TP) condition leads to Tr ( ) Tr ( ) ρ , and the operator E must satisfy ( ) where where ⊗ , and λ is the Lagrange multiplier in matrix form to satisfy the TP condition of Eq. (S4).
Varying Eq. (S5) with respect to E will give the extremal equation for operator Tr 0 Eq. (S6) holds for all E δ , then Combining two variations of Eq. (S7), the symmetrical expression suitable for iterations is derived ( ) ( ) where i denotes the i -th iteration.This expression preserves the positive semi-definiteness and trace normalization of the operator since i i i R E R is positive-definite and the iterations satisfy ( ) , where K d is the dimension of space K , the estimated operator i E will gradually approach the theoretical operator of the test results during the numerical iterations.

Supplementary Note 4: Example of the Deutsche algorithm
As can be seen from Fig. S4, the Deutsche algorithm consists of four steps: 1. Prepare input states.The first qubit labeled as x is initialized to | 0 x 〉 , and the second qubit y is initialized to | 0 y 〉 .Then apply H gates to each qubit, yielding 2. Apply the quantum oracle.The oracle maps the input state When the qubit x is | 0 x 〉 , the corresponding ( ) , and vice versa.Note the x and y used in the Dirac notation only indicate the qubits and do not have any assigned value, whereas the x and y used as inputs in the oracle have assigned values.So, the Eq.(S10) could be 3. Apply an H gate to each qubit.The final state will be  The CNOT gate is an example that implements a balanced function: ( ) Similarly, the identity operation is an example of a constant function implementation: ( ) The characteristic of implementing a simple combination of multiple basic quantum gates in a single D 2 NN is also showcased through the application of the Deutsch algorithm.In essence, the D 2 NN functions by fitting the transformation matrix of the inputs and outputs.For a given number of dimensions, such as the case with four dimensions here, a combination of multiple basic quantum gates still results in a four-dimensional unitary matrix, thereby maintaining the same fitting complexity for the D 2 NN.To provide specific details, the gate loaded onto SLM2 is represented as ( ⨂ ) 4 for the constant situation and ( ⨂ ) for the balanced situation.Here,  signifies the two-dimensional Hadamard gate, and  4 represents the fourdimensional identity matrix.The process matrices for these two situations are visually presented in Fig. S4b.
Additionally, the compression of a more extensive two-qubit circuit or higher dimensions, are also possible.

Supplementary Note 5: Update rules for spacing optimization
Finding the optimal spacing that maximizes performance is an optimization problem that is difficult to solve for physical systems.Fortunately, in our case, finding a local optimum is sufficient.To achieve this, we use a search protocol that scans a given range with a certain precision.The pseudo-code for the protocol is as follows.
S2) According to ref. 1, all inequivalent sets of MUBs in three dimensions could be derived from the Hadamard matrices.The state vectors | i ψ 〉 are the columns of these Hadamard matrices, thus 12 states in total.It is convenient to verify by calculating where d is the dimension.

Fig. S3 .
Fig. S3.Quantum process tomography of spatial mode quantum gates.a-c Tomography matrices and d-f reconstructed process matrices χ for the X 2 gate, H 2 gate and H 3 gate.

S12) 4 .
Measure the final state 3 |ψ 〉 .Theoretically, only the measurement of qubit x is necessary, and a constant function will be measured as | 0 x 〉 and a balanced function as |1 x 〉 .

Fig. S4 .
Fig. S4.Deutsch algorithm diagrams.a Quantum circuit for the Deutsch algorithm.The circuit can be subdivided into four main components.The oracle function denoted as f O applies identity operator to qubit x , while applying XOR with ( ) f x to qubit y .b Combinations of the Oracle operations and interference operations in a single D 2 NN and corresponding process matrices.
H I is the identity operator on space H . Measurements n Π are carried out on the corresponding

Algorithm 1 :
Our update rules for spacing optimization.Function